// 常量配置
// 调用时直接导入此文件后， 示例：window._const.level_list
let bindToGlobal = (obj, key = '_const') => {
    if (typeof window[key] === 'undefined') {
        window[key] = {};
    }

    for (let i in obj) {
        window[key][i] = obj[i]
    }
}

// 用户权限
const level = {
    'level_list': [
        {'label': '浏览权限', 'value': 1},
        {'label': '执行测试权限', 'value': 2},
        {'label': '平台测试数据管理权限', 'value': 3},
        {'label': '用户管理员权限', 'value': 4},
        {'label': '开发者权限', 'value': 5},
    ]
}
bindToGlobal(level, '_const')

const base = {
    'base_case_list': [
        // 测试case name为key： 传入后端值为value
        {label: '基础测试', value: 'case1',},
        {label: '基础测试2', value: 'case2',},
        {label: '基础测试3', value: 'case3',},
        {label: '基础测试4', value: 'case4',},
    ],
    'tools_list': ["memtester", "netperf", "iperf", "redis", "fio", "dd"],
    'baseForm': {
        case_name: '',
        environment: '线上',
        region: '',
        tools: [],
        remarks: "",
        clear: '清理',
        report_status: '否',
    },
    'rules': {
        case_name: [
            {required: true, message: '请输入活动名称', trigger: 'change'},
            {min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'change'}
        ],
    },
    'baseScheduleForm': {
        case_name: '',
        environment: '线上',
        region: '',
        tools: [],
        remarks: "",
        clear: '清理',
        date: '',
        time: '',
        report_status: '否',
    },
    'baseScheduleRules': {
        case_name: [
            {required: true, message: '请输入活动名称', trigger: 'change'},
            {min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'change'}
        ],
        date: [
            {type: 'date', required: true, message: '请选择日期', trigger: 'change'}
        ],
        time: [
            {type: 'date', required: true, message: '请选择时间', trigger: 'change'}
        ],
    }
}
bindToGlobal(base, '_const')